package com.djk.controller;


import com.djk.constants.SessionKeys;
import com.djk.pojo.User;
import com.djk.service.UserService;
import com.djk.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    public Result Login(String username, String password, HttpSession session) {
        log.info("用户登录...");
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        return userService.login(user,session);
    }
}
